home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 4
/
Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso
/
Development
/
General
/
ppc.basic2.9b2 Folder
/
chipbasic.2.9b2.README
next >
Wrap
Text File
|
1994-03-17
|
4KB
|
117 lines
*ppc_chipbasic 2.9b2 README*
Every *real* personal computer should come with a BASIC interpreter.
Here's my contribution for the new Power Macintosh machines. It's a
line number based BASIC interpreter similar to the Applesoft BASIC that
came with the Apple ][+ (that's Apple ][, *NOT* Mac II for you
newcomers). This version runs ONLY on Power Macs.
Chipmunk Basic is a simple Basic interpreter for the Macintosh. It is
similar to the line number based MumbleSoft BASIC interpreters of circa
1980. Its roots are from a pascal program, basic.p, that was part of
the test input suite to p2c, a pascal to c translator. Both basic.p
and p2c should be in the net.sources archives somewhere (I no longer
have copies). I cleaned up the translated source, ported it to the Mac
and added some Mac specific features.
Chipmunk Basic 2.9 is being distributed as freeware (but only for those who
don't believe that using the BASIC language causes brain damage. :-)
Please note that there are far better versions of BASIC available
commercially. Just none that run PowerPC native and are available for
the Mac as of March 14th.
Version 2.9b2 fixes a static text bug when running under virtual memory.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; not even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.
---
Quick Reference for Chipmunk Basic v2.9b2 - Macintosh version
ported by Ronald H. Nicholson, Jr. 94-Mar-14 rhn@netcom.com
- This is a simple version of Basic similar to Applesoft BASIC.
- The interpreter includes a standard line number based editor.
- The usual amount of numeric and string operators and functions and
file I/O statements are available.
- The two variable types are long floats and strings with a maximum length
of 254 characters. Variable names can be up to 32 characters long.
- Unusual features include:
The ability to play accurate morse code through the sound manager.
Some simple graphics commands in a separate graphics window.
Operator, functions and statements include:
+ - * / ^ mod and or xor not
sqr() log() exp() abs() sgn() sin() cos() tan() log() arctan()
int() rnd() peek() val() asc() len() fre
mid$() right$() left$() str$() chr$()
let goto gosub return for to step next while wend dim data read def
rem input print open input# output append as close# load save run
inkey$ date$ time$
timer eof()
stop end exit quit renum new
moveto lineto gotoxy graphics() mouse() cls sound morse
Some Examples:
open "filename" for output as #1 : print #1, a$ : close #1
c$ = a$ + b$ : rem string concatenation
graphics(0) : moveto 10,10 : lineto 110,80 : rem graphics window
gotoxy 0,10 : print "here" : rem text window
sound 440,0.5,30 : rem freq, secs_dur, vol 0-100
sound 0,128 : rem play snd resource 128
morse "CQ DE N6YWU",16,40,13,700 : rem dot_wpm,vol,letter_wpm,freq
open "SFGetFile" for input as #2 : rem "SFPutFile" works for output also
some experimental graphics commands:
(The graphics commands in version 2.9b are beta test and may be buggy.)
GRAPHICS 0 // init graphics window
graphics MOVETO x,y // MoveTo
graphics LINETO x,y // LineTo
graphics OVAL x,y // oval x wide by y high
graphics DRAWTEXT a$ // DrawText
graphics RECT x1,y1,x2,y2 // FrameRect
graphics FILLRECT x1,y1,x2,y2,pat# // PaintRect
graphics OVAL x1,y1,x2,y2 // FrameOval
graphics FILLOVAL x1,y1,x2,y2,pat# // PaintOval
graphics PENSETUP xsize, ysize, [ mode, pat# ]
graphics COLOR i // set RGBForeColor by index
graphics COLOR r,g,b // red green blue 0-100
graphics TEXTSETUP f, s, m // font, size, mode
SPRITE n x, y, id // sprite n @ x,y using ICN# id
// n from 1 to 15, 1 in frontmost plane
sprite n UP x // sprite #n move up x pixels
sprite n DOWN x
sprite n LEFT x // move LEFT (not turn as in Logo!)
sprite n RIGHT x
sprite n TURN d // turn CCW d degrees
sprite n FORWARD x // move forward x pixels
sprite n PENUP
sprite n PENDOWN
---
1 rem sieve benchmark
2 t = timer
3 dim f(8194)
4 for i = 0 to 8191 : f(i) = 1 : next i
5 s = 8191
6 for i = 0 to s
7 if f(i) = 0 then goto 11
8 p = i+i+3
9 for k = i+p to s step p : f(k) = 0 : next k
10 c = c+1
11 next i
12 print c;" primes found in ";
13 t = timer-t
14 print t;" seconds"
15 end
--- cut here ---